package util;

import static org.junit.Assert.*;

import org.junit.Test;

public class MyBitSetTest {

	@Test
	public void testEqual() {
		MyBitSet mbs1 = new MyBitSet("1111 1111");
		MyBitSet mbs2 = new MyBitSet("1111 1111");
		assert (mbs1.equals(mbs2));

		mbs1 = new MyBitSet("1111 1111");
		mbs2 = new MyBitSet("1110 1111");
		assert (mbs1.equals(mbs2));
	}

	@Test
	public void testPermute() {
		MyBitSet mbs = new MyBitSet("1111 1111");
		int[] perm = { 3, 6, 4, 1, 8, 2, 7, 5 };
		MyBitSet result = mbs.permute(perm);

		if (result.equals(mbs))
			assert (true);
		else
			assert (false);

		assertEquals(mbs, mbs);

		int[] invPerm = { 4, 7, 1, 3, 8, 2, 7, 5 };

		result = result.permute(invPerm);

		if (result.equals(mbs))
			assert (true);
		else
			assert (false);

		mbs = result.permute(invPerm);

		if (!result.equals(mbs))
			assert (true);
		else
			assert (false);

	}

}
